package com.nhim.cms.domain;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.Version;

import static javax.persistence.GenerationType.IDENTITY;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;

/**
 * ElementTemplate entity. @author Huy Lieu Ta
 */
@Entity
@Table(name = "nhim_element_template", catalog = "nhim_cms")
public class ElementTemplate implements java.io.Serializable {

	// Fields

	/**
	 * 
	 */
	private static final long serialVersionUID = 5768017961598716468L;
	private Integer id;
	private ElementDefinition elementDefinition;
	private String emptyText;
	private String footerText;
	private String headerText;
	private String name;
	private String normalText;
	private Integer version;

	// Constructors

	/** default constructor */
	public ElementTemplate() {
	}

	/** full constructor */
	public ElementTemplate(ElementDefinition elementDefinition,
			String emptyText, String footerText, String headerText,
			String name, String normalText) {
		this.elementDefinition = elementDefinition;
		this.emptyText = emptyText;
		this.footerText = footerText;
		this.headerText = headerText;
		this.name = name;
		this.normalText = normalText;
	}

	// Property accessors
	@Id
	@GeneratedValue(strategy = IDENTITY)
	@Column(name = "id", unique = true, nullable = false)
	public Integer getId() {
		return this.id;
	}

	public void setId(Integer id) {
		this.id = id;
	}
	
	@Version
	@Column(name = "version")
	public Integer getVersion() {
		return this.version;
	}

	public void setVersion(Integer version) {
		this.version = version;
	}

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "element_id")
	public ElementDefinition getElementDefinition() {
		return this.elementDefinition;
	}

	public void setElementDefinition(ElementDefinition elementDefinition) {
		this.elementDefinition = elementDefinition;
	}
	

	@Column(name = "emptyText", length = 65535)
	public String getEmptyText() {
		return this.emptyText;
	}

	public void setEmptyText(String emptyText) {
		this.emptyText = emptyText;
	}

	@Column(name = "footerText", length = 65535)
	public String getFooterText() {
		return this.footerText;
	}

	public void setFooterText(String footerText) {
		this.footerText = footerText;
	}

	@Column(name = "headerText", length = 65535)
	public String getHeaderText() {
		return this.headerText;
	}

	public void setHeaderText(String headerText) {
		this.headerText = headerText;
	}

	@Column(name = "name", length = 100)
	public String getName() {
		return this.name;
	}

	public void setName(String name) {
		this.name = name;
	}

	@Column(name = "normalText", length = 65535)
	public String getNormalText() {
		return this.normalText;
	}

	public void setNormalText(String normalText) {
		this.normalText = normalText;
	}

}